<?php
// no direct access
defined( '_AppMiage' ) or die( 'Restricted access' );
if(isEntreprise ()){
    //include header
    include_once (DS.'include/header.php');
    //include menu
    include_once (DS.'include/menu.php');

    if(isset($_GET['uid']) && !empty($_GET['uid']))
    {
        $offre = new Offre($_GET['uid']);
        $owner = new ContactEntreprise($offre->getIdContactEntreprise());
        if($global_member->getIdEntreprise() != $owner->getIdEntreprise())
        {
            redirectTo(URL."index.php?m=app_entreprise_historiqueoffre");
        }
    }
    else
    {
        redirectTo();
    }

    ?>
    <div id="content">
        <div class="post">
            <div class="entry">
                <h3 class="title">Visualisation de l'offre</h3>
            </div>
            <div class="entry">
                <fieldset title="&Eacute;tape 1">
                    <legend>Informations G&eacute;n&eacute;rales</legend>
                    <label>Titre de l'offre : </label>
                    <?php echo $offre->getTitreOffre(); ?>
                    <br /><br />
                    <label>Date de debut : </label>
                    <?php echo date('d/m/y',$offre->getDateDebutOffre()); ?>
                    <br /><br />
                    <label>Date de fin : </label>
                    <?php echo date('d/m/y',$offre->getDateFinOffre()); ?>
                    <br /><br />
                    <label>Nombre d'offre : </label>
                    <?php echo $offre->getNombrePosteOffre(); ?>
                    <br /><br />
                    <label>Comp&eacute;tence : </label><br />
                    <?php echo stripslashes($offre->getCompetenceOffre()); ?>
                    <br /><br />
                    <label>Description : </label><br />
                    <?php echo stripslashes($offre->getDescriptionOffre()); ?>
                    <br /><br />
                    <label>Cat&eacute;gorie : </label><br />
                    <table>
                    <?php
                                    $IdsCategorie = $offre->getIdsCategorie();
                                    foreach($IdsCategorie as $cat){
                                            ?>
                        <tr >
                            <td>
                                                    <?php
                            $categorie = new Categorie($cat);
                            echo $categorie->getNomCategorie();
                            ?>
                            </td>
                        </tr>
                        <?php
                                    }
                                    ?>
                    </table>
                                    <label>Technologie : </label><br />
                    <table>
                    <?php
                                    $listTechnoIdTechno = $offre->getIdsTechnologie();

                                    foreach($listTechnoIdTechno as $techno){
                                            ?>
                        <tr>
                            <td>
                        <?php
                                            $technologie = new Technologie($techno);
                                            echo $technologie->getNomTechnologie();
                                            ?>
                            </td>
                        </tr>
                        <?php
                                    }
                                    //rajouter le getIdsPromo()
                                    ?>
                    </table>

                    <label>Promo : </label><br />
                    <table>
                    <?php
                                    $listIdsPromo = $offre->getIdsPromo();

                                    foreach($listIdsPromo as $p){
                                            ?>
                        <tr>
                            <td>
                        <?php
                                            $promo = new Promo($p);
                                            echo $promo->getNom();
                                            ?>
                            </td>
                        </tr>
                        <?php
                                    }
                                    ?>
                    </table>
                </fieldset>
            </div>
        </div>
    </div>
    <?php
    include_once (DS.'include/sidebar.php');
    include_once (DS.'include/footer.php');
}
else
{
    redirectTo();
}
?>